import Vue from 'vue'
import VueRouter from 'vue-router'
import BookIndex from '../views/BookIndex.vue'



Vue.use(VueRouter)

const routes = [
  {
    path:'/login',
    name:'登录',
    component:()=>import("../views/login.vue")
  },
  {
    path:'/register',
    name:'注册',
    component:()=>import("../views/Register.vue")
  },
  // 主路由
  {
    path: '/',
    name: '导航',
    component: BookIndex,
    children: [
      { path: '/one', name: '书籍信息', component: () => import('../views/PageOne.vue') },
      { path: '/two', name: '增加书籍', component: () => import('../views/PageTwo.vue') },
      { path: '/three', name: '借阅信息', component: () => import('../views/PageThree.vue') },
      { path: '/four', name: '添加借阅', component: () => import('../views/PageFour.vue') }
    
    ]
  },
  // admin 相关路由
  {
    path: '/adminHome', // 确保路径正确
    redirect: '/adminIndex',
    component: () => import('@/views/admin/AdminHome.vue'),
    children: [
      { path: '/adminIndex', component: () => import('@/views/admin/AdminIndex.vue') },
      { path: '/bookManager', component: () => import('@/views/admin/BookManager.vue') },
      { path: '/borrowManager', component: () => import('@/views/admin/BorrowManager.vue') }
    ]
  }
];
const router = new VueRouter({
  routes
})

export default router
